__author__ = 'st316'
'''
Given two numbers represented as strings, return multiplication of the numbers as a string.

Note: The numbers can be arbitrarily large and are non-negative.
'''


class Solution:
    # @param num1, a string
    # @param num2, a string
    # @return a string
    def multiply(self, num1, num2):
        pass

    def computeSum(self, num1, num2):
        mapper = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}
        i = len(num1) - 1
        j = len(num2) - 1
        c = 0
        s = []
        while i > -1 and j > -1:
            r = c + mapper[num1[i]] + mapper[num2[j]]
            s.append(r % 10)
            c = r / 10
            i -= 1
            j -= 1
        while i > -1:
            r = c + mapper[num1[i]]
            s.append(r % 10)
            c = r / 10
            i -= 1
        while j > -1:
            r = c + mapper[num1[j]]
            s.append(r % 10)
            c = r / 10
            j -= 1
        if c:
            s.append(c)
        t = ''
        for i in xrange(1, len(s) + 1):
            t += s[-i].__repr__()
        return t


if __name__ == '__main__':
    s = Solution()
    print s.computeSum('1234', '123')